package com.qf.iostream;

import java.io.File;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class FileCopyChar {
	public static void main(String[] args) {
		
		String inputPath="D:\\Workspace\\Practice\\src\\laoyouji2.txt";
		String outputPath="D:\\Workspace\\Practice\\src\\copyWriteByChar.txt";
		
		FileCopyCharByStream(inputPath,outputPath);
		
		
		
		
	}
	
	public static void FileCopyCharByStream(String inputPath,String outputPath) {
		
		
		
		try {
			File r = new File(inputPath);
			
			File w = new File(outputPath);
			
			FileReader reader = new FileReader(r);
			
			FileWriter writer = new FileWriter(w);
			
			
			//文件拷贝：字符流
			char[] cs = new char[10];
			int len =-1;
			while((len=reader.read(cs))!=-1) {
				writer.write(cs,0,len);
				
			}
			
			
			System.out.println("字符流文件拷贝成功...");
			
		}catch(IOException e) {
			
			System.out.println("文件读入异常...");
			e.printStackTrace();
		}
		
		
		
		
		
	}

}
